﻿<Wpf:TRCBaseWindow x:Class="TMSPS.TRC.Forms.ManageServersForm"
    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
    xmlns:Wpf="clr-namespace:TMSPS.TRC.BL.Wpf"
    xmlns:Controls="clr-namespace:TMSPS.TRC.Controls"
    Title="Manage servers" Height="390" Width="586" WindowStartupLocation="CenterScreen" Closing="TRCBaseWindow_Closing">
    <Grid>
        <Grid.RowDefinitions>
            <RowDefinition Height="*" />
            <RowDefinition Height="35" />
        </Grid.RowDefinitions>
        <Grid.ColumnDefinitions>
            <ColumnDefinition MaxWidth="200"/>
            <ColumnDefinition MinWidth="350"  Width="*" />
        </Grid.ColumnDefinitions>
        
        <GroupBox Header="Servers" Margin="5,0,5,0" Grid.Row="0" Grid.Column="0" >
            <ListBox Name="ServerListBox" ItemsSource="{Binding }" Margin="2" DisplayMemberPath="Name" SelectionChanged="ServerListBox_SelectionChanged"  />
        </GroupBox>

        <Grid Grid.Row="1" Grid.Column="0" >
            <Grid.RowDefinitions>
                <RowDefinition Height="*" />
            </Grid.RowDefinitions>
            <Grid.ColumnDefinitions>
                <ColumnDefinition Width="*"/>
                <ColumnDefinition Width="*"/>
            </Grid.ColumnDefinitions>
            <Button Name="AddServerButton"  Grid.Row="0" Grid.Column="0" Content="Add server" MinWidth="75" Margin="5" HorizontalAlignment="Center" Click="AddServerButton_Click" />
            <Button Name="DeleteServerButton"  Grid.Row="0" Grid.Column="1" Content="Delete server" MinWidth="75" Margin="5" HorizontalAlignment="Center" Click="DeleteServerButton_Click" />
        </Grid>

        <GroupBox Header="Server Properties" Grid.Row="0" Grid.Column="1" Margin="5,0,5,0"  >
            <Controls:ManageServerControl x:Name="ManageServerControlUI" />
        </GroupBox>

        <Grid Grid.Row="1" Grid.Column="1" >
            <Grid.RowDefinitions>
                <RowDefinition Height="*" />
            </Grid.RowDefinitions>
            <Grid.ColumnDefinitions>
                <ColumnDefinition Width="*"/>
                <ColumnDefinition Width="*"/>
                <ColumnDefinition Width="*"/>
            </Grid.ColumnDefinitions>
            
            <Button Name="ApplyChangesButton" Content="Apply changes" Margin="5" MinWidth="100"   Grid.Row="0" Grid.Column="0" HorizontalAlignment="Center" Click="ApplyChangesButton_Click" IsEnabled="{Binding ElementName=ManageServerControlUI, Path=HasChangedAndIsValid }" />
            <Button Name="DiscardChangesButton" Content="Discard changes" Margin="5" MinWidth="100" Grid.Row="0" Grid.Column="1" HorizontalAlignment="Center" Click="DiscardChangesButton_Click" IsEnabled="{Binding ElementName=ManageServerControlUI, Path=WasModified }" />
            <Button Name="LeaveDialogButton" Content="Leave dialog" Margin="5" MinWidth="100" Grid.Row="0" Grid.Column="2" HorizontalAlignment="Center" Click="LeaveDialogButton_Click" />
        </Grid>
    </Grid>
</Wpf:TRCBaseWindow>
